package com.eastfair.pay.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.core.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

/**
 * <p>
 * 实体类
 * 付款记录
 * </p>
 *
 * @author clm
 * @since 2022-06-08
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("pay_payment_record")
@ApiModel(value = "PaymentRecord", description = "付款记录")
@AllArgsConstructor
public class PaymentRecord extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;
    /**
     * 收款单位id
     */
    @ApiModelProperty(value = "收款单位id")
    @TableField(value = "company_id")
    private Long companyId;
    /**
     * 收款单位
     */
    @ApiModelProperty(value = "收款单位")
    @Size(max = 255, message = "收款单位长度不能超过255")
    @TableField(value = "company_name", condition = LIKE)
    private String companyName;
    /**
     * 对方户名
     */
    @ApiModelProperty(value = "对方户名")
    @Size(max = 255, message = "对方户名长度不能超过255")
    @TableField(value = "bank_account_name", condition = LIKE)
    @Excel(name = "对方户名")
    private String bankAccountName;

    /**
     * 对方账号
     */
    @ApiModelProperty(value = "对方账号")
    @Size(max = 35, message = "对方账号长度不能超过35")
    @TableField(value = "bank_account_number", condition = LIKE)
    @Excel(name = "对方账号")
    private String bankAccountNumber;

    /**
     * 开户行
     */
    @ApiModelProperty(value = "开户行")
    @Size(max = 255, message = "开户行长度不能超过255")
    @TableField(value = "bank_name", condition = LIKE)
    @Excel(name = "开户行")
    private String bankName;

    /**
     * 付款金额
     */
    @ApiModelProperty(value = "付款金额")
    @TableField(value = "pay_amount")
    @Excel(name = "付款金额")
    private BigDecimal payAmount;

    /**
     * 付款时间
     */
    @ApiModelProperty(value = "付款时间")
    @TableField(value = "pay_time")
    @Excel(name = "付款时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime payTime;

    /**
     * 认款状态
     */
    @ApiModelProperty(value = "认款状态")
    @TableField(value = "collect_state")
    @Excel(name = "认款状态")
    private String collectState;

    /**
     * 认领金额
     */
    @ApiModelProperty(value = "认领金额")
    @TableField(value = "collect_amount")
    @Excel(name = "认领金额")
    private BigDecimal collectAmount;

    /**
     * 付款方式(数据字典)
     */
    @ApiModelProperty(value = "付款方式(数据字典)")
    @Size(max = 255, message = "付款方式(数据字典)长度不能超过255")
    @TableField(value = "pay_type", condition = LIKE)
    @Excel(name = "付款方式(数据字典)")
    private String payType;

    /**
     * 单号
     */
    @ApiModelProperty(value = "单号")
    @Size(max = 255, message = "单号长度不能超过255")
    @TableField(value = "business_code", condition = LIKE)
    @Excel(name = "单号")
    private String businessCode;

    /**
     * 付款流水号
     */
    @ApiModelProperty(value = "付款流水号")
    @Size(max = 255, message = "付款流水号(数据字典)长度不能超过255")
    @TableField(value = "mainno", condition = LIKE)
    private String mainno;

    @Builder
    public PaymentRecord(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId, 
                    String bankAccountName, String bankAccountNumber, String bankName, BigDecimal payAmount, LocalDateTime payTime, String collectState,
                    BigDecimal collectAmount, String payType) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.bankAccountName = bankAccountName;
        this.bankAccountNumber = bankAccountNumber;
        this.bankName = bankName;
        this.payAmount = payAmount;
        this.payTime = payTime;
        this.collectState = collectState;
        this.collectAmount = collectAmount;
        this.payType = payType;
    }

}
